package com.ddpt.platform.common.dto;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ddpt.platform.common.base.BaseEntity;
import lombok.Data;

@Data
public class PageDto extends BaseEntity {

    //当前页
    private Integer currentPage;

    //显示条数
    private Integer showCount;

    public PageDto() {}

    public PageDto(Integer currentPage, Integer showCount) {
        this.currentPage = currentPage;
        this.showCount = showCount;
    }

    public <T>Page<T> toMpDefault(){
        if (null == showCount){
            this.showCount = 10;
        }
        if (null == currentPage){
            this.currentPage = 1;
        }
        return toMp();
    }

    public <T>Page<T> toMp(){
        return new Page<>(this.currentPage, this.showCount);
    }
}
